<template>
    <div class="action-buttons">
        <!--店铺/客服/购物车/加入购物车/立即购买-->
        <div class="action-tool" @click="shopStore">
            <div><img src="/src/assets/icons/dp.jpeg"></div>
            <div>店铺</div>
        </div>
        <div class="action-tool" @click="service">
            <div><img src="/src/assets/icons/service.png"></div>
            <div>客服</div>
        </div>
        <div class="action-tool" @click="mallCar">
            <div><img src="/src/assets/icons/mall-car.png"><label>99</label></div>
            <div>购物车</div>
        </div>
        <div>
            <button class="addToCart" @click="addToCart">加入购物车</button>
        </div>
        <div>
            <button class="buyNow" @click="buyNow">立即购买</button>
        </div>
    </div>
</template>
<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const shopStore = () => {
    alert("打开店铺");
}

const service = () => {
    router.push({name: 'serviceChat'});
}

const mallCar = () => {
    router.push({name: 'shoppingCar'});
}

const addToCart = () => {
    alert('已加入购物车！');
};

const buyNow = () => {
    router.push({name: 'balance'});
};



</script>
<style scoped>
.action-buttons {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    background-color: #fff;
    margin: auto;
    font-size: 12px;
    overflow: hidden;
}
.action-tool {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: #333;
    width: 100%;
    margin: auto;
    overflow: auto;
    position: relative;
    cursor: pointer;
}
.action-tool img {
    width: 20px;
    height: 18px;
    padding-top: 3px;
}
.action-tool label {
    border-radius: 50px;
    width: 12px;
    height: 12px;
    color: #fff;
    background-color: red;
    font-size: 8px;
    position: fixed;
    margin-top: 2px;
    margin-left: -5px;
    padding-top: -6px;
    text-align: center;
}
.action-buttons button {
  margin: 5px;
  margin-top: 7px;
  border-radius: 50px;
  cursor: pointer;
  font: 14px;
}

.action-buttons .addToCart {
    background-color: transparent;
    color: #007bff;
    border: 1px solid #007bff;
}
.action-buttons .buyNow {
    background-color: #007bff;
    border: none;
    color: white;
}
</style>